<%--
  Created by IntelliJ IDEA.
  User: H64
  Date: 2021/4/22
  Time: 9:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>用户登录</title>
</head>
<body>
<%
    //定义访问次数
    //定义访问次数
    Integer count  = (Integer) application.getAttribute("count");

    //第一次获取时，没有向application容器加count变量，此时count为空
    //第二次获取时，向application容器加count变量，此时count不为空
    if (count == null){

        count = 1;//初始化count

    }else {
        count++;//获取每次登录时的访问次数
    }
    application.setAttribute("count",count);//向application容器加入count访问次数的变量
%>
<%

    Integer i = (Integer) application.getAttribute("count");
    out.print("本站访问人数为："+i);
%>
<form action="LoginServlet" method="post" class="form-horizontal">
    <div>
        <ul style="list-style-type: none">
            <li>
                <p style="margin-left: 120px">用户登录</p>
            </li>
            <li>
                <span>用户名：</span>
                <input type="text" name="username">
            </li>
            <li>
                <span  style="padding-right: 16px">密码：</span>
                <input type="text" name="userpsw">
            </li>
            <li>
                <button type="submit" name="button" class="red_button" style="float: left">确认</button>
                <button type="button" name="button" style="float: left;margin-left: 164px">取消</button>
            </li>
        </ul>
    </div>
</form>
</body>
</html>
